module.exports = {
  head: {
    title: "仿真",
    meta: [
      { charset: "utf-8" },
      { name: "viewport", content: "width=device-width, initial-scale=1" },
      { hid: "description", name: "description", content: "Nuxt.js project" }
    ],
    link: [{ rel: "icon", type: "image/x-icon", href: "/nercar.jpg" }],
    htmlAttrs: {
      class: "theme-them-deep"
    },
    bodyAttrs: {
      class: "app-container"
    }
  },
  loading: { color: "#3B8070" },
  /*
   ** Global CSS
   */
  css: [
    { src: "~assets/css/elementChange.scss", lang: "scss" },
    "@/assets/css/baseStyle.scss",
    "@/assets/icon/iconfont.css"
  ],
  /**
   * include third-party plugin
   */
  plugins: [
    "@/plugins/element-ui",
    "@/plugins/directive",
    "@/plugins/api",
    "@/plugins/filters",
    "@/plugins/ApiAll",
    "@/plugins/i18n",
    "@/plugins/enumeration",
    { src: "~/plugins/vue-global.js", ssr: false }
  ],
  modules: ["@nuxtjs/axios", "@nuxtjs/proxy"],

  router: {
    mode: "history"
  },

  server: {
    port: 8201,
    host: "0.0.0.0"
  },

  axios: {
    baseURL: "http://10.9.1.118:9910/", // 设置统一URL,关闭代理时使用.
    timeout: 60000,
    retry: { retries: 3 },
    proxy: true
  },
  proxy: {
    "/api": {
      target: "http://10.9.1.118:9910/", // 仿真
      pathRewrite: { "^/api/": "" },
      changeOrigin: true,
      logLevel: "debug"
    }
  },
  /*
   ** Build configuration
   */
  build: {
    extractCSS: true, // 确保样式会注入到 body 标签
    /*
     ** Run ESLint on save
     */
    extend(config, { isDev, isClient }) {
      if (isDev && isClient) {
        config.module.rules.push({
          enforce: "pre",
          test: /\.(js|vue)$/,
          loader: "eslint-loader",
          exclude: /(node_modules)/
        });
      }
    }
  }
};
